package com.kingdee.eas.custom.rcbudget.ekingwin.www.esb.QMYX_SUNAC_363_easBrokerageBillApprove;

import com.kingdee.eas.custom.rcbudget.ekingwin.www.esb.error.v1.ErrorType;
import com.kingdee.eas.custom.rcbudget.ekingwin.www.esb.header.v1.Header;
import com.kingdee.eas.custom.rcbudget.ekingwin.www.esb.header.v1.holders.HeaderHolder;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
import javax.xml.namespace.QName;
import org.apache.axis.AxisFault;
import org.apache.axis.NoEndPointException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Stub;
import org.apache.axis.constants.Style;
import org.apache.axis.constants.Use;
import org.apache.axis.description.FaultDesc;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.encoding.DeserializerFactory;
import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
import org.apache.axis.encoding.ser.ArraySerializerFactory;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.encoding.ser.EnumDeserializerFactory;
import org.apache.axis.encoding.ser.EnumSerializerFactory;
import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
import org.apache.axis.encoding.ser.SimpleListDeserializerFactory;
import org.apache.axis.encoding.ser.SimpleListSerializerFactory;
import org.apache.axis.encoding.ser.SimpleSerializerFactory;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.utils.JavaUtils;

public class QMYX_SUNAC_363_easBrokerageBillApprove_pttBindingStub extends Stub
  implements QMYX_SUNAC_363_easBrokerageBillApprove_ptt
{
  private Vector cachedSerClasses = new Vector();
  private Vector cachedSerQNames = new Vector();
  private Vector cachedSerFactories = new Vector();
  private Vector cachedDeserFactories = new Vector();

  static OperationDesc[] _operations = new OperationDesc[1];

  static { _initOperationDesc1();
  }

  private static void _initOperationDesc1()
  {
    OperationDesc oper = new OperationDesc();
    oper.setName("QMYX_SUNAC_363_easBrokerageBillApprove");
    ParameterDesc param = new ParameterDesc(new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", "QMYX_SUNAC_363_easBrokerageBillApprove"), 1, new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">QMYX_SUNAC_363_easBrokerageBillApprove"), QMYX_SUNAC_363_easBrokerageBillApprove.class, false, false);
    oper.addParameter(param);
    param = new ParameterDesc(new QName("http://www.ekingwin.com/esb/header/v1", "commonHeader"), 3, new QName("http://www.ekingwin.com/esb/header/v1", "Header"), Header.class, true, true);
    oper.addParameter(param);
    oper.setReturnType(new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">response"));
    oper.setReturnClass(Response.class);
    oper.setReturnQName(new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", "response"));
    oper.setStyle(Style.DOCUMENT);
    oper.setUse(Use.LITERAL);
    oper.addFault(
      new FaultDesc(new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", "QueryFault"), 
      "com.kingdee.eas.custom.rcbudget.ekingwin.www.esb.QMYX_SUNAC_363_easBrokerageBillApprove.QueryFault", 
      new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">QueryFault"), 
      true));

    _operations[0] = oper;
  }

  public QMYX_SUNAC_363_easBrokerageBillApprove_pttBindingStub() throws AxisFault
  {
    this(null);
  }

  public QMYX_SUNAC_363_easBrokerageBillApprove_pttBindingStub(URL endpointURL, javax.xml.rpc.Service service) throws AxisFault {
    this(service);
    this.cachedEndpoint = endpointURL;
  }

  public QMYX_SUNAC_363_easBrokerageBillApprove_pttBindingStub(javax.xml.rpc.Service service) throws AxisFault {
    if (service == null)
      this.service = new org.apache.axis.client.Service();
    else {
      this.service = service;
    }
    ((org.apache.axis.client.Service)this.service).setTypeMappingVersion("1.2");

    Class beansf = BeanSerializerFactory.class;
    Class beandf = BeanDeserializerFactory.class;
    Class enumsf = EnumSerializerFactory.class;
    Class enumdf = EnumDeserializerFactory.class;
    Class arraysf = ArraySerializerFactory.class;
    Class arraydf = ArrayDeserializerFactory.class;
    Class simplesf = SimpleSerializerFactory.class;
    Class simpledf = SimpleDeserializerFactory.class;
    Class simplelistsf = SimpleListSerializerFactory.class;
    Class simplelistdf = SimpleListDeserializerFactory.class;
    QName qName = new QName("http://www.ekingwin.com/esb/error/v1", "errorType");
    this.cachedSerQNames.add(qName);
    Class cls = ErrorType.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);

    qName = new QName("http://www.ekingwin.com/esb/header/v1", "Header");
    this.cachedSerQNames.add(qName);
    cls = Header.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);

    qName = new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">QMYX_SUNAC_363_easBrokerageBillApprove");
    this.cachedSerQNames.add(qName);
    cls = QMYX_SUNAC_363_easBrokerageBillApprove.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);

    qName = new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">QueryFault");
    this.cachedSerQNames.add(qName);
    cls = QueryFault_Element.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);

    qName = new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", ">response");
    this.cachedSerQNames.add(qName);
    cls = Response.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);

    qName = new QName("http://www.ekingwin.com/esb/QMYX_SUNAC_363_easBrokerageBillApprove", "HEADER");
    this.cachedSerQNames.add(qName);
    cls = HEADER.class;
    this.cachedSerClasses.add(cls);
    this.cachedSerFactories.add(beansf);
    this.cachedDeserFactories.add(beandf);
  }

  protected Call createCall() throws RemoteException
  {
    try {
      Call _call = super._createCall();
      if (this.maintainSessionSet) {
        _call.setMaintainSession(this.maintainSession);
      }
      if (this.cachedUsername != null) {
        _call.setUsername(this.cachedUsername);
      }
      if (this.cachedPassword != null) {
        _call.setPassword(this.cachedPassword);
      }
      if (this.cachedEndpoint != null) {
        _call.setTargetEndpointAddress(this.cachedEndpoint);
      }
      if (this.cachedTimeout != null) {
        _call.setTimeout(this.cachedTimeout);
      }
      if (this.cachedPortName != null) {
        _call.setPortName(this.cachedPortName);
      }
      Enumeration keys = this.cachedProperties.keys();
      while (keys.hasMoreElements()) {
        String key = (String)keys.nextElement();
        _call.setProperty(key, this.cachedProperties.get(key));
      }

      synchronized (this) {
        if (firstCall())
        {
          _call.setEncodingStyle(null);
          for (int i = 0; i < this.cachedSerFactories.size(); i++) {
            Class cls = (Class)this.cachedSerClasses.get(i);
            QName qName = 
              (QName)this.cachedSerQNames.get(i);
            Object x = this.cachedSerFactories.get(i);
            if ((x instanceof Class)) {
              Class sf = 
                (Class)this.cachedSerFactories.get(i);
              Class df = 
                (Class)this.cachedDeserFactories.get(i);
              _call.registerTypeMapping(cls, qName, sf, df, false);
            }
            else if ((x instanceof javax.xml.rpc.encoding.SerializerFactory)) {
              org.apache.axis.encoding.SerializerFactory sf = 
                (org.apache.axis.encoding.SerializerFactory)this.cachedSerFactories.get(i);
              DeserializerFactory df = 
                (DeserializerFactory)this.cachedDeserFactories.get(i);
              _call.registerTypeMapping(cls, qName, sf, df, false);
            }
          }
        }
      }
      return _call;
    } catch (Throwable _t) {
    }
    throw new AxisFault("Failure trying to get the Call object", _t);
  }

  public Response QMYX_SUNAC_363_easBrokerageBillApprove(QMYX_SUNAC_363_easBrokerageBillApprove parameters, HeaderHolder parameters2) throws RemoteException, QueryFault_Element
  {
    if (this.cachedEndpoint == null) {
      throw new NoEndPointException();
    }
    Call _call = createCall();
    _call.setOperation(_operations[0]);
    _call.setUseSOAPAction(true);
    _call.setSOAPActionURI("QMYX_SUNAC_363_easBrokerageBillApprove");
    _call.setEncodingStyle(null);
    _call.setProperty("sendXsiTypes", Boolean.FALSE);
    _call.setProperty("sendMultiRefs", Boolean.FALSE);
    _call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
    _call.setOperationName(new QName("", "QMYX_SUNAC_363_easBrokerageBillApprove"));

    setRequestHeaders(_call);
    setAttachments(_call);
    try { Object _resp = _call.invoke(new Object[] { parameters, parameters2.value });

      if ((_resp instanceof RemoteException)) {
        throw ((RemoteException)_resp);
      }

      extractAttachments(_call);

      Map _output = _call.getOutputParams();
      try {
        parameters2.value = ((Header)_output.get(new QName("http://www.ekingwin.com/esb/header/v1", "commonHeader")));
      } catch (Exception _exception) {
        parameters2.value = ((Header)JavaUtils.convert(_output.get(new QName("http://www.ekingwin.com/esb/header/v1", "commonHeader")), Header.class));
      }
      try {
        return (Response)_resp;
      } catch (Exception _exception) {
        return (Response)JavaUtils.convert(_resp, Response.class);
      }
    } catch (AxisFault axisFaultException)
    {
      if (axisFaultException.detail != null) {
        if ((axisFaultException.detail instanceof RemoteException)) {
          throw ((RemoteException)axisFaultException.detail);
        }
        if ((axisFaultException.detail instanceof QueryFault_Element))
          throw ((QueryFault_Element)axisFaultException.detail);
      }
    }
    throw axisFaultException;
  }
}